import {esri} from "../../api/esriAPI";

export class Fullscreen {
  constructor(viewManage) {
    this._viewManage = viewManage;
  }

  add(position = "bottom-left") {
    let view = this._viewManage.getMapView();
    if (!view) {
      return;
    }
    let fullScreen = new esri.Fullscreen({
      view: view,
      // element: applicationDiv//DOM对象
    });
    view.ui.add(fullScreen, {position});
    this._fullScreen = fullScreen;
  }

  /**
   * 移除比例尺
   */
  remove() {
    let view = this._viewManage.getMapView();
    if (!view) {
      return;
    }
    view.ui.remove(this._fullScreen);
  }
}

